package com.kikt.viewpagerindicationdemo.fragment;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.kikt.viewpagerindicationdemo.R;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * Created by kikt on 2016/3/13.
 */
public class TextFragment extends Fragment {
    @Bind(R.id.tv)
    TextView mTv;

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle
            savedInstanceState) {
        Bundle arguments = getArguments();
        String text = arguments.getString("text");
        View rootView = inflater.inflate(R.layout.fragment1, container, false);
        ButterKnife.bind(this, rootView);
        mTv.setText(text);
        return rootView;
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        ButterKnife.unbind(this);
    }

    public static TextFragment newInstance(String text) {
        Bundle args = new Bundle();
        args.putString("text", text);
        TextFragment fragment = new TextFragment();
        fragment.setArguments(args);
        return fragment;
    }
}
